/*
 * @Descripttion: 说明
 * @version: V1.0
 * @Author: GaoWei
 * @Date: 2021-04-25 12:11:55
 * @LastEditors: GaoWei
 * @LastEditTime: 2021-06-18 17:52:37
 */
import {axios} from "../../utils/request";

//供应商档案
const api = {
    list: "/vendor/page",  
    save: "/vendor/save",  
    delete: "/vendor/delete",

    downloadUrl: "/vendor/downloadImportTemplate",
    importUrl:"/vendor/importData",
    exportUrl:"/vendor/exportData",
}
/**
 * 列表
 */
export function list(parameter) {
    return axios({
      url: api.list,
      method: "get",
      params: parameter
    });
  }

/**
 * 保存
 */
export function save(parameter) {
  return axios({
    url: api.save,
    method: "post",
    data: parameter
  });
}

/**
 * 删除
 */
export function remove(parameter) {
  return axios({
    url: api.delete,
    method: "delete",
    params: parameter
  });
}

/**
* 下载导入数据模板
*/
export function downloadDemo(parameter) {
    return axios({
        url: api.downloadUrl,
        method: "get",
        params: parameter,
        responseType: 'blob'
    });
}

/**
* 导出数据
*/
export function exportSupplierData(parameter) {
    return axios({
        url: api.exportUrl,
        method: "get",
        params: parameter,
        responseType: 'blob'
    });
}


/**
 * 导入数据
 */
export function importSupplierData(data) {
    return axios({
        url: api.importUrl,
        method: "post",
        data: data,
        headers: {
            "Content-Type": "multipart/form-data"
        },
        timeout: 5000000,
    });
}